<template>
  <div class="father">
    <h3>父组件</h3>
    <div class="content">
     <Category title="具名插槽">
      <!-- 用插槽的名字限制显示的位置 -->
       <!-- 第一种写法 -->
      <template v-slot:place>
        <ul>
        <li v-for="g in games" :key="g.id">{{ g.name }}</li>
      </ul>
      </template>
      <template v-slot:content>
        <div>
          第一站：宁波
        </div>
      </template>
     </Category>
     <!-- 第二种写法 -->
     <Category title="具名插槽">
      <template #content>
        <div>
          第二站：南京
        </div>
      </template>
      <template #place>
        <div>
          <img :src="imgUrl" alt=""/>
        </div>
      </template>
      
     </Category>
     <!-- 默认插槽 -->
     <Category title="默认插槽">
      <video :src="videoUrl" controls></video>
     </Category>
    </div>
  </div>
</template>

<script setup lang="ts" name="Father">
  import Category from './Category.vue'
  import { ref,reactive } from "vue";

  let games = reactive([
    {id:'asgytdfats01',name:'英雄联盟'},
    {id:'asgytdfats02',name:'王者农药'},
    {id:'asgytdfats03',name:'红色警戒'},
    {id:'asgytdfats04',name:'斗罗大陆'}
  ])
  let imgUrl = ref('https://z1.ax1x.com/2023/11/19/piNxLo4.jpg')
  let videoUrl = ref('https://www.iqiyi.com/v_u1912qj70w.html?s3=pca_115_IP_card&s4=0&vfrmblk=pca_115_IP_card&vfrm=3&s2=3&vfrmrst=0')

</script>

<style scoped>
  .father {
    background-color: rgb(165, 164, 164);
    padding: 20px;
    border-radius: 10px;
  }
  .content {
    display: flex;
    justify-content: space-evenly;
  }
  img,video {
    width: 100%;
  }
  h2 {
    background-color: orange;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
  }
</style>